<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>一站通</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <link rel="stylesheet" href="/static/css/my/common.css"/>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
</head>

<body>
<div class="x-nav">
			<span class="layui-breadcrumb">
				<a href="">首页</a>
				<a href="">人事管理</a>
				<a><cite>员工信息管理</cite></a>
			</span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()"
       title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="my-left">
        <div id="test13">
            <ul id="demo"></ul>
        </div>
    </div>
    <div class="my-right">
        <div class="layui-card-header">
            <div class="layui-form layui-col-space4">
                <div class="layui-input-inline layui-show-xs-block">
                    <input class="layui-input" placeholder="通过名字查找" name="name" id="searchName">
                </div>
                <div class="layui-input-inline layui-show-xs-block">
                    <span id="searchInfo" style="color: red;"></span>
                </div>
                <div class="layui-input-inline layui-show-xs-block">
                    <button class="layui-btn layui-btn-danger" id="searchButton"><i class="layui-icon">&nbsp;</i>搜索</button>
                </div>
                <div class="layui-input-inline layui-show-xs-block">
                    <button class="layui-btn" onclick="xadmin.open('添加员工信息','/staff/staffManagerAdd',700,500)">
                        <i class="layui-icon"></i>添加员工信息
                    </button>
                </div>
            </div>
        </div>
        <div class="layui-card-body">
            <table class="layui-table layui-form">
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>职位</th>
                        <th>手机号</th>
                        <th>级别</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr th:each="staff:${page.records}">
                        <td th:text="${staff.name}"></td>
                        <td th:text="${staff.sex}"></td>
                        <td th:text="${staff.position}"></td>
                        <td th:text="${staff.tel}">110</td>
                        <td th:text="${staff.level}"></td>
                        <td>
                            <a th:href="@{'/staff/staffDelete?id='+${staff.id}}">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="layui-card-body ">
            <div class="page">
                <div>
                    <a class="num" th:href="@{'/staff/staffManagerQuery?pageIndex=1'}">首页</a>
                    <a class="prev" th:if="${page.current>1}" th:href="@{'/staff/staffManagerQuery?pageIndex=1'}">&lt;&lt;</a>
                    <a class="num" th:text="${page.current}" th:href="@{'/staff/staffManagerQuery?pageIndex='+${page.current}}"></a>
                    <a class="num" th:text="${page.current+1}" th:href="@{'/staff/staffManagerQuery?pageIndex='+${page.current+1}}"></a>
                    <a class="num" th:text="${page.current+2}" th:href="@{'/staff/staffManagerQuery?pageIndex='+${page.current+2}}"></a>
                    <a class="next" th:if="${page.current<page.pages}" th:href="@{'/staff/staffManagerQuery?pageIndex='+${page.current+1}}">&gt;&gt;</a>
                    <a class="next" th:href="@{'/staff/staffManagerQuery?pageIndex='+${page.pages}}">尾页</a>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script  type="text/javascript" th:inline="javascript">
    var treeData = [[${tree}]];
    console.log(treeData)
    layui.use(['tree'], function () {
        var tree = layui.tree,
            $ = layui.jquery;
        $('#searchName').focus(function () {
            $('#searchInfo').html('')
        });
        $('#searchButton').click(function () {
            let name = $('#searchName').val();
            if (name==null || name==''){
                $('#searchInfo').html('输入名字为空');
                return;
            }else{
                window.open("/staff/staffManagerQueryName?name="+name,'_self');
            }
        });
        var inst1 = tree.render({
            elem: '#demo',
            showLine: true,
            data: treeData
        });
    });

</script>

</html>
